<template>
    <div class="app-container home">
        <van-cell title="修改登录密码" is-link to="/resetLoginPassword" />
        <van-cell title="修改支付密码" is-link to="/getCode" />
        <van-cell title="隐私协议" is-link to="/privacy" />
        <div class="btn">
            <van-button @click="goLogin" type="primary" color="#66d6ff" block>退出登录</van-button>
        </div>
    </div>
</template>

<script setup name="setUp">
import { showConfirmDialog } from 'vant'
import store from '../../store'

const router = useRouter()
const goLogin = () => {
    showConfirmDialog({
        title: '退出登录',
        message: '确定退出登录吗？'
    })
        .then(() => {
            var u = navigator.userAgent
            var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)
            var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1 //android终端
            if (isiOS) {
                console.log('isiOS')
                window.webkit.messageHandlers.login().postMessage({ title: '', content: '', url: '' }) //ios
            } else if (isAndroid) {
                //注意：安卓只需要传字符串
                console.log('isAndroid')
                window.android.finishFromJS()
            }
        })
        .catch(() => {
            // on cancel
        })
}
const jump = () => {}
</script>

<style scoped lang="scss">
.app-container.home {
    padding: 10px;
    .btn {
        margin-top: 10px;
        border-radius: 10px;
        overflow: hidden;
    }
}
</style>
